package com.neu.envprotection.report.controller;

import com.neu.envprotection.airQuality.dto.resp.GetAQIDistributionRespDto;
import com.neu.envprotection.airQuality.dto.resp.GetAQITrendRespDto;
import com.neu.envprotection.airQuality.dto.resp.GetProvinceAQIRespDto;
import com.neu.envprotection.common.constant.SystemConfigConsts;
import com.neu.envprotection.common.resp.RestResp;


import com.neu.envprotection.report.service.ReportService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/report")
@RequiredArgsConstructor
@SecurityRequirement(name = SystemConfigConsts.HTTP_AUTH_HEADER_NAME)
@Tag(name = "获取数据统计")
@Slf4j
public class ReportController {
    @Autowired
    private ReportService reportService;

    @PostMapping ("/provinceAqi")
    @Operation(summary = "获取省的AQI数据")
    private RestResp<List<GetProvinceAQIRespDto>> getProvinceAQI(){
        return reportService.getProvinceAQI();
    }

    @PostMapping ("/aqiDistribution")
    @Operation(summary = "aqi分布")
    private RestResp<List<GetAQIDistributionRespDto>> getAQIDistribution(){
        return reportService.getAQIDistribution();
    }

    @PostMapping ("/aqiTrend")
    @Operation(summary = "aqi趋势")
    private RestResp<List<GetAQITrendRespDto>> getAQITrend(){
        return reportService.getAQITrend();
    }

    @GetMapping("/fullChinaCharts")
    @Operation(summary = "获得所有省的污染等级")
    private RestResp<List<Map<String,Integer>>> getChinaRank(){
        return reportService.getChinaAQI();
    }

}
